package com.hooper.user.service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.hooper.hosp.model.user.UserInfo;
import com.hooper.hosp.vo.user.LoginVo;
import com.hooper.hosp.vo.user.UserAuthVo;
import com.hooper.hosp.vo.user.UserInfoQueryVo;
import com.hooper.user.vo.UserVo;

import javax.servlet.http.HttpServletRequest;
import java.util.Map;

/**
 * @author Tim Hooper
 * @version 1.0
 * @time 2022/10/03/14:46
 */
public interface UserService extends IService<UserInfo> {

    /**
     * login method, currently support user log in by their phone with sms code
     *
     * @param loginVo contains user info
     * @return user info including name, phone ,token etc
     */
    Map<String, Object> login(LoginVo loginVo);

    /**
     * get user info by openid
     *
     * @param openid wechat open id
     * @return user
     */
    UserInfo getUserByOpenid(String openid);

    /**
     * complete the user info including user's ID, real name, ID card picture etc
     *
     * @param authVo  user info
     * @param request get user id from token
     */
    void getUserAuth(UserAuthVo authVo, HttpServletRequest request);

    /**
     * page query by conditions (conditions can be null)
     *
     * @param currentPage current page
     * @param pageSize    the size of a page
     * @param queryVo     query conditions
     * @return
     */
    IPage<UserInfo> pageByConditions(int currentPage, int pageSize, UserInfoQueryVo queryVo);

    /**
     * lock a user by its id
     *
     * @param id     user id
     * @param status 1: normal 0:banned
     */
    void lock(String id, Integer status);

    UserVo getUserDetail(String id);

    void approval(String userId, Integer authStatus);
}
